feat: add a examples field to check metadata #8068
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously, examples for checks were stored in separate files for each provider. For example, the examples for Terraform
<name>
checks were in the<name>.tf.go
file, and the examples for CloudFormation were in<name>.cf.go
. With the discontinuation of support for Go checks, there is no longer a need to store examples in Go files as it makes them harder to retrieve. Therefore, the examples for each check have been moved from Go to YAML with a new schema:Currently, the check metadata includes fields for each provider with the same structure:
I have an idea to convert test data for Dockerfile and Kubernetes into examples for integration testing and display on a website. (draft PR). However, the current approach when adding a new provider requires the following steps:
This process is awkward and inflexible. To simplify it, I propose to introduce a new
examples
field, which will contain the path to the file with examples to check, replacing the current fields with providers:Along with this, the structure of the example file can be updated to make it more flexible:
Checklist